package com.nbsaas.boot.cms.rest.resource;

import com.nbsaas.boot.cms.api.apis.DownFileApi;
import com.nbsaas.boot.cms.data.entity.DownFile;
import com.nbsaas.boot.cms.api.domain.request.DownFileRequest;
import com.nbsaas.boot.cms.api.domain.response.DownFileResponse;
import com.nbsaas.boot.cms.api.domain.simple.DownFileSimple;
import com.nbsaas.boot.cms.rest.convert.DownFileSimpleConvert;
import com.nbsaas.boot.cms.rest.convert.DownFileEntityConvert;
import com.nbsaas.boot.cms.rest.convert.DownFileResponseConvert;
import com.nbsaas.boot.cms.data.repository.DownFileRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class DownFileResource extends BaseResource<DownFile,DownFileResponse, DownFileSimple, DownFileRequest>  implements DownFileApi {

    @Resource
    private DownFileRepository downFileRepository;

    @Override
    public JpaRepositoryImplementation<DownFile, Serializable> getJpaRepository() {
        return downFileRepository;
    }

    @Override
    public Function<DownFile, DownFileSimple> getConvertSimple() {
        return new DownFileSimpleConvert();
    }

    @Override
    public Function<DownFileRequest, DownFile> getConvertForm() {
        return new DownFileEntityConvert();
    }

    @Override
    public Function<DownFile, DownFileResponse> getConvertResponse() {
        return new DownFileResponseConvert();
    }




}


